package com.tanhua.server.controller;


import com.tanhua.server.service.UserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.*;

import java.util.Map;

/**
 * @auther : 白月尘
 * @date : 14:15  2021/10/16
 */
@RestController
@RequestMapping("/user")
public class LoginController {

    @Autowired
    private UserService userService;

    @PostMapping("/login")
    public ResponseEntity login(@RequestBody Map map) {
        String mobile = (String) map.get("phone");
        userService.checkFreezeState(mobile);
        //  userService.sendMsg(mobile);
        return ResponseEntity.ok(null);
    }

    @PostMapping("/loginVerification")
    public ResponseEntity loginVerification(@RequestBody Map map) {
        String mobile = (String) map.get("phone");
        String verificationCode = (String) map.get("verificationCode");
        Map retMap = userService.findByMobile(mobile, verificationCode);
        return ResponseEntity.ok(retMap);
    }
}
